package com.cytanaa.youlike;


import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Window;


public class Slpash extends Activity {

	  //how long until we go to the next activity
    protected int _splashTime = 3000; 

    private Thread splashTread;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.activity_slpash);


        // thread for displaying the SplashScreen
        splashTread = new Thread() {
            @SuppressWarnings({ "finally" })
			@Override
            public void run() {
                try {
                    synchronized(this){

                            wait(_splashTime);
                    }

                } catch(InterruptedException e) {}
                finally {
                    finish();
                	Log.i("in the thread","finished");


                    //start a new activity
                    Intent i = new Intent(Slpash.this, Login.class);
                    startActivity(i);
                    return;
                    }
            }
        };

        splashTread.start();
    }

    //Function that will handle the touch
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            synchronized(splashTread){
                    splashTread.notifyAll();
            }
        }
        return true;
    }

    
}
